#include "MapInfoPanel.hpp"

MapInfoPanel::MapInfoPanel():Panel(0, 29, 200, 42, Panel::Static){
    map = 0;

    title.setPosition(5, 2);
    title.setString(10, sf::Color::White, sf::Text::Underlined, "Map Info");
    add(&title);

    nameHeader.setPosition(5, 18);
    nameHeader.setString(10, sf::Color::White, sf::Text::Regular, "Name: ");
    add(&nameHeader);

    name.setPosition(nameHeader.labelText.getLocalBounds().width + 10,18);
    name.maxLength = 15;
    name.setString(10, sf::Color::White, sf::Text::Regular, std::string(""));
    name.setSize(190, 18);
    add(&name);

    size.setPosition(5, 31);
    size.setString(10, sf::Color::White, sf::Text::Regular,  std::string(""));
    add(&size);

}

/**
* Set the map of this MapInfoPanel.
* @param setMap Map to set to.
*/
void MapInfoPanel::setMap(Map* setMap){
    map = setMap;
    name.setString(map->name);
    size.setString("Width: " + StringHelper::itos(map->width) + " Height: " + StringHelper::itos(map->height));
}